from django.db import models
from tagging.fields import TagField
from prettypony.portfolio.models import Project, Client

class Person(models.Model):
    """
    Someone who said something nice about you.
    """
    
    name = models.CharField(max_length=255)
    slug = models.SlugField(unique=True)
    client = models.ForeignKey(Client, blank=True, null=True, help_text="Is this person a client or does this person work for one of your clients?")
    description = models.TextField(blank=True, help_text="Anything you want to note about this person?")
    url = models.URLField('URL', blank=True, help_text="If this person isn't a client, or their URL is different than their company's.")
    created = models.DateTimeField(auto_now_add=True)
    updated = models.DateTimeField(auto_now=True)
    
    class Meta:
       verbose_name_plural = 'people'
       ordering = ('name',)
    
    def __unicode__(self):
        return self.name
    
    # # If using the get_absolute_url method, put the following line at the top of this file:
    # from django.db.models import permalink
    # 
    # @models.permalink
    # def get_absolute_url(self):
    #     return ('person_detail_view_name', [str(self.id)])

class Quote(models.Model):
    """
    Someone said something nice about you.
    """

    person = models.ForeignKey(Person, blank=True, null=True)
    project = models.ForeignKey(Project, blank=True, null=True, help_text="Does this quote pertain to a particular project?")
    quote = models.TextField(help_text="It would be a good idea to put a &lt;blockquote&gt; around this field in your templates.")
    tags = TagField()
    public = models.BooleanField(default=True, help_text="Do you want this quote to show up on the site right now?")
    created = models.DateTimeField(auto_now_add=True)
    updated = models.DateTimeField(auto_now=True)
    
    class Meta:
       ordering = ('-created',)
    
    def __unicode__(self):
        return self.quote
    
    # # If using the get_absolute_url method, put the following line at the top of this file:
    # from django.db.models import permalink
    # 
    # @models.permalink
    # def get_absolute_url(self):
    #     return ('quote_detail_view_name', [str(self.id)])
